//抽象工厂--遵从开放封闭原则
class MobilePhoneFactory{
    creatOS(){
        throw new ErrorEvent('抽象工厂不允许直接调用')
    }

    creatHardWare(){
        throw new ErrorEvent('抽象工厂不允许直接调用')
    }
}

// new MobilePhoneFactory().creatOS()

class OS{
    contorlHardWare(){
        throw new ErrorEvent('抽象工厂不允许直接调用')
    }
}


class AndroidOS extends OS{
    contorlHardWare(){
       console.log('我回用安卓的方式去操作系统');
    }
}

class IOS extends OS{
    contorlHardWare(){
       console.log('我回用苹果的方式去操作系统');
    }
}


class HardWare{
    operateByOrder(){
        throw new ErrorEvent('抽象工厂不允许直接调用')
    
    }
}

class QualcommHardWare{
    
}

class WnStarFactory extends MobilePhoneFactory{
    creatOS(){
        return new AnroidOS()
    
    }
    creatHardWare(){
        return new QualcommHardWare()
    }
       
}